"""
projection.py

Created by daspork on 2012-04-20.
Copyright (c) 2012 Knuckledragger Games. All rights reserved.
"""

from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *


def set3D(width, height):
    glEnable(GL_DEPTH_TEST) 
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluPerspective(40.0, float(width)/float(height), 0.1, 1000.0)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()


def set2D(width, height):
    glDisable(GL_DEPTH_TEST) 
    glMatrixMode(GL_PROJECTION)
    glLoadIdentity()
    gluOrtho2D(0, width, 0, height)
    glMatrixMode(GL_MODELVIEW)
    glLoadIdentity()

    
def setViewport(width, height):
    glViewport(0, 0, width, height)


